#define _CRT_SECURE_NO_WARNINGS


#include<stdio.h>

int main()
{
    int arr[10000];
    int n = 0;
    int i = 0;

    scanf("%d", &n);

    int max = 0;
    int min = 100;

    for (i = 0; i < n; i++)
    {
        scanf("%d ", &arr[i]);
        if (max < arr[i])
            max = arr[i];
        if (min > arr[i])
            min = arr[i];
    }

    printf("%d\n", max - min);


    return 0;
}